<!DOCTYPE html>
<html>
<head lang="en">
	<meta charset="UTF-8">
	<title>百朋后台管理系统</title>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/demo.css">
	<script type="text/javascript" src="__PUBLIC__/easyui/jquery.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/easyui/jquery.easyui.min.js"></script>
</head>
<style type="text/css">
	.input 
	{
		border: 1px solid #eaeaea;
		background-color: #6d654e;
		color: #fff;
		text-align: center;
		padding: 0px 10px -1px;
		border-radius: 4px;
	}
</style>
<body>
	<div class="invest_table">
		<table id="invest_table" title="商户拜访日志" style="width:100%;min-height:372px;" 
			data-options="
				remoteSort:false,
				rownumbers:true,
				singleSelect:true,
				autoRowHeight:false,
				pagination:true,
				pageSize:10,toolbar:'#tb'
			"
		>
			<thead>
				<tr>
					<th field="visitlog_name" width="15%" align="center">商户简称</th>
					<th field="visitlog_type" width="6%" align="center">信息获取</th>
					<th field="visitlogdetail_count" width="6%" align="center">拜访次数</th>
					<th field="visitlog_person" width="7%" align="center">联系人</th>
					<th field="visitlog_phone" width="10%" align="center">联系电话</th>
					<th field="visitlog_address" width="13%" align="center">地址</th>
					<th field="user_name" width="8%" align="center">商务代表</th>
					<th field="create_time" width="10%" align="center" sortable="true">创建时间</th>
					<th field="update_time" width="10%" align="center" sortable="true">更新时间</th>
					<th field="mark" width="8%" align="center" sortable="true">商户状态</th>
					<th field="action" width="6%" align="center" formatter="formatAction">操作</th>
				</tr>
			</thead>
		</table>
	</div>
	<div id="tb" style="padding:5px;height:auto">
		<form action="../../facilitator/visitlog/visitlog_manage" method="post" id="searchTable">
			<div>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;商户名称: <input class="easyui-textbox" id="select_name" name="select_name" value="{$search_array.select_name}" data-options="prompt:'关键字搜索...'" style="width:120px">&nbsp;&nbsp;&nbsp;&nbsp;
				商户类型: 
				<select class="easyui-combobox selector" id="select_businesstype" name="select_businesstype" panelHeight="auto" style="width:120px" data-options="editable:false">
					<option value="">请选择</option>
					<?php
						foreach ($array_businesstype as $key => $value) 
						{
							echo '<option value="'.$value['id'].'">'.$value['name'].'</option>';
						}
					?>
				</select>&nbsp;&nbsp;&nbsp;&nbsp;
				<script type="text/javascript">$("#select_businesstype").find("option[value='{$search_array.select_businesstype}']").attr("selected",true);</script>
				所属商圈: 
				<select class="easyui-combobox selector" id="select_circle" name="select_circle" panelHeight="auto" style="width:120px" data-options="editable:false">
					<option value="">请选择</option>
					<?php
						foreach ($array_circle as $key => $value) 
						{
							echo '<option value="'.$value['circle_id'].'">'.$value['circle_name'].'</option>';
						}
					?>
				</select>&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="javascript:;" onclick="visitlog_add();" class="easyui-linkbutton" iconCls="icon-add">新增</a><br><br>
				<script type="text/javascript">$("#select_circle").find("option[value='{$search_array.select_circle}']").attr("selected",true);</script>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;拜访时间: 
				<input class="easyui-datebox" id="select_time" data-options="formatter:myformatter,parser:myparser,editable:false" name="select_time" value="{$search_array.select_time}" style="width:120px">&nbsp;&nbsp;&nbsp;&nbsp;
				商务代表: 
				<select class="easyui-combobox selector" id="select_user" name="select_user" panelHeight="auto" style="width:120px" data-options="editable:false">
					<option value="">请选择</option>
					<?php
						foreach ($array_user as $key => $value) 
						{
							echo '<option value="'.$value['user_id'].'">'.$value['user_name'].'</option>';
						}
					?>
				</select>&nbsp;&nbsp;&nbsp;&nbsp;
				<script type="text/javascript">$("#select_user").find("option[value='{$search_array.select_user}']").attr("selected",true);</script>
				商户状态: 
				<select class="easyui-combobox selector" id="select_mark" name="select_mark" panelHeight="auto" style="width:120px" data-options="editable:false">
					<option value="">请选择</option>
					<option value="1">跟进</option>
					<option value="0">淘汰</option>
					<option value="2">已转审核</option>
				</select>&nbsp;&nbsp;&nbsp;&nbsp;
				<script type="text/javascript">$("#select_mark").find("option[value='{$search_array.select_mark}']").attr("selected",true);</script>
				<a href="javascript:;" onclick="submitSearch();" class="easyui-linkbutton" iconCls="icon-search">查询</a>&nbsp;&nbsp;
				<a href="javascript:;" onclick="resetSearch();" class="easyui-linkbutton" iconCls="icon-clear">重置</a>&nbsp;&nbsp;
				
			</div>
		</form>
	</div>

	<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
	<script type="text/javascript">
		$(function() 
		{
			var json = '{$json_visitlog}';
			var array = JSON.parse(json);
			$('#invest_table').datagrid({loadFilter:pagerFilter}).datagrid('loadData', array);
		});

		function submitSearch() 
		{
			$("#searchTable").submit();
		}

		function resetSearch() 
		{
			$("#select_name").textbox("setValue","");
			$("#select_businesstype").combobox("setValue","");
			$("#select_circle").combobox("setValue","");
			$("#select_time").textbox("setValue","");
			$("#select_user").combobox("setValue","");
			$("#select_mark").combobox("setValue","");
		}

		function formatAction(value,row,index) 
		{
			var a = '<input type="button" value="详情" class="input" onclick="visitlog_see('+row.visitlog_id+');">';
			return a;
		}

		function visitlog_see(visitlog_id) 
		{
			window.parent.addTab('拜访日志详情','../../facilitator/visitlog/visitlog_see?visitlog_id='+visitlog_id);
		}

		function visitlog_add() 
		{
			window.parent.addTab("新增商户拜访日志","../../facilitator/visitlog/visitlog_add");
		}
	</script>
</body>
</html>